<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>案例实战</title>
  <style>
    .red{
      color: red;
    }
  </style>
</head>

<body>
  <div id="root">
    <ul>
      <!-- 遍历li就v-for就放到li里面,不要放到ul里面 -->
      <!-- <li v-for="item in movies">{{item}}</li> -->
      <!-- m是变量名,movies是列表 -->
      <li v-for="(m,index) in movies" :class="[color]">{{index}}-{{m}} <button @click="changeColor()">换颜色</button></li>
    </ul>
  </div>
  <script src="../practice_project/js/vue.js"></script>
  <script>
    const root = new Vue({
      el: '#root',
      data: {
        movies: ['海王', '海尔兄弟', '火影忍者', '进击的巨人'],
        color:'red'
      },
      methods: {
        changeColor() {
          this.movies[0]
        }
      }
    })
  </script>
</body>

</html>